<!DOCTYPE html
	PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">

<head>
	<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
	<title>登录商城</title>
	<link rel="stylesheet" type="text/css" href="style/style.css">
	<link rel="stylesheet" type="text/css" href="style/global.css">
	<link rel="stylesheet" href="style/header.css" type="text/css">
	<link rel="stylesheet" href="style/login.css" type="text/css">
	<script type="text/javascript" src="js/jquery-1.8.3.min.js"></script>
</head>
<body>
		<!-- 顶部导航 start -->
		<div class="topnav">
			<div class="topnav_bd w990 bc">
				<div class="topnav_right fr" >
					<ul>
						<li>您好，欢迎来到京西！[<a href="login.html">登录</a>] [<a href="register.html">免费注册</a>] </li>
						<li class="line">|</li>
						<li>我的订单</li>
						<li class="line">|</li>
						<li>客户服务</li>
					</ul>
				</div>
			</div>
		</div>
	<!-- 顶部导航 end -->
	<div style="clear:both;"></div>

	<!-- 页面头部 start -->
	<div class="header w990 bc mt15">
		<div class="logo w990" >
			<h2 class="fl"><a href="index.html"><img src="images/hz.png" style="width: 50%;margin-left: 85%;" alt="恒之办公"></a></h2>
		</div>
	</div>
	<!-- 登录主体部分start -->
	<div class="login w990 bc mt10" style="margin-left: 25%;">
		<div class="login_hd">
			<h2>用户登录</h2>
			<b></b>
		</div>
		<div class="login_bd">
			<div class="login_form fl">
				<form action="" method="post">
					<ul>
						<li>
							<label for="">用户名：</label>
							<input type="text" class="txt" id="username" name="username" />
						</li>
						<li>
							<label for="">密码：</label>
							<input type="password" class="txt" id="password" name="password" />
						</li>
						<li>
							<label for="">&nbsp;</label>
							<input type="checkbox" class="chb" /> 保存登录信息
						</li>
						<li>
							<label for="">&nbsp;</label>
							<input type="button" value="" onclick="login()" class="login_btn">
						</li>
					</ul>
			</div>
			<div class="guide fl">
				<h3>还不是商城用户</h3>
				<p>现在免费注册成为商城用户，便能立刻享受便宜又放心的购物乐趣，心动不如行动，赶紧加入吧!</p>
				<a href="regist.html" class="reg_btn">免费注册 >></a>
			</div>
		</div>
	</div>
	<!-- 登录主体部分end -->
	<div style="clear:both;"></div>
	<script src="js/layer/layer.js"></script>
	
	<span id="newfooter"></span>
    <script src="js/footer.js"></script>
	<script>
		function login() {
			   var username =$("#username").val();
			   var password =$("#password").val();
			$.ajax({
				type: "POST",
				dataType: "json",
				url: "http://hengzhi.ayvvv.com/api/auth/login",
				handler: {
					'x-token' :'aa'
				},
				data: {
					account:username,
					password:password,
				},
				success: function (result) {
					var JSONobj = JSON.stringify(result);
					if (result.status == 200) {
						 window.localStorage.setItem('token',result.data.token);
						layer.msg('登录成功');
					setTimeout(function(){
                       window.location.href="index.html";
					},1000);
				}else{
						layer.msg('账号或密码错误');
					};
				},
				error: function () {
					layer.msg('异常！');
				}
			});
		}
	</script>

</body>

</html>